/*************************************************************************
> File Name: main.c
> Author: icebear
> Mail: 3322366195@qq.com
> Created Time: 2023-07-29 11:30:59
> Description: 结构体位段
************************************************************************/

#include <stdio.h>

typedef struct A_S
{
    char a : 4;
    char b : 4;
} A;
typedef struct B_S
{
    char a : 4;
    char b : 4;
    unsigned short s : 8;
} B;
typedef struct C_S
{
    char a : 4;
    char b : 4;
    unsigned short s : 8;
    // 对齐 补位
    unsigned long l;
} C;
int main(int argc, char const *argv[])
{
    // printf("%d\n", sizeof(long));
    printf("unsigned long %d\n", sizeof(unsigned long));
    printf("A %d\n", sizeof(A));
    printf("B %d\n", sizeof(B));
    printf("C %d\n", sizeof(C));
    return 0;
}
